package com.example.love_margin.Mapper.configuer;


import com.example.love_margin.Entity.Pet;
import org.apache.ibatis.jdbc.SQL;

public class UpdatePet {

    public String UpOnePet(Pet pet){
        return new SQL() {
            {
                UPDATE("pet");
                if (pet.getPet_name() != null) {
                    SET("pet_name = #{pet_name}");
                }
                if (pet.getPet_age() != null) {
                    SET("pet_sex = #{pet_sex}");
                }
                if (pet.getPet_sex() != null) {
                    SET("pet_age = #{pet_age}");
                }
                if (pet.getPet_picture() != null) {
                    SET("pet_picture = #{pet_picture}");
                }
                if (pet.getPet_category() != null) {
                    SET("pet_category = #{pet_category}");
                }
                if (pet.getPet_varieties() != null) {
                    SET("pet_varieties = #{pet_varieties}");
                }
                if (pet.getPet_vaccine() != null) {
                    SET("pet_vaccine = #{pet_vaccine}");
                }
                if (pet.getPet_sterilization() != null) {
                    SET("pet_sterilization = #{pet_sterilization}");
                }
                if (pet.getPet_insects() != null) {
                    SET("pet_insects = #{pet_insects}");
                }
                if (pet.getPet_adopt_condition() != null) {
                    SET("pet_adopt_condition = #{pet_adopt_condition}");
                }
                if (pet.getPet_adopt_process() != null) {
                    SET("pet_adopt_process = #{pet_adopt_process}");
                }
                if (pet.getPet_how_adopt() != null) {
                    SET("pet_how_adopt = #{pet_how_adopt}");
                }
                if (pet.getPet_push_date() != null) {
                    SET("pet_push_date = #{pet_push_date}");
                }
                if (pet.getPet_about_me() != null) {
                    SET("pet_about_me = #{pet_about_me}");
                }
                WHERE("pet_id= #{pet_id}");
            }
        }.toString();
    }
}
